package com.example.kafka_demo.api;

import com.example.kafka_demo.dto.ParamsDetail;
import com.example.kafka_demo.service.KafkaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Keson
 * @version 1.0
 * @description: TODO kafka测试发送Api
 * @date 2021/9/6 15:46
 */
@RestController
@RequestMapping("/order")
public class OrderApi {

    @Autowired
    private KafkaService kafkaService;

    @GetMapping("/sendMessage")
    public String sendMessage(@RequestBody ParamsDetail paramsDetail){
        kafkaService.sendMessage(paramsDetail);
        return "消息发送成功！";
    }
}
